oldName = input('请输入你要备份的文件名：')

index = oldName.rfind('.')
if index > 0:
    newName = oldName[:index] + '[备份]' + oldName[index:]
    try:
        old_f = open(oldName, 'rb')
        new_f = open(newName, 'wb')
        # 防止文件过大
        while True:
            con = old_f.read(3)
            if len(con) == 0:
               break
            new_f.write(con)
        old_f.close()
        new_f.close()
    except:
        print('文件名不存在')
else:
    print('文件名无效')
